package com.yuxin.spirngboot;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Import;
import org.springframework.context.annotation.ImportResource;

import com.yuxin.spirngboot.config.MyConfig;

@SpringBootApplication

// 导入spring配置文件
@ImportResource(locations = { "classpath:spring.xml" })

// 导入配置类
@Import(value = { MyConfig.class })
public class SpringbootHelloworldStartApplication {

	static Logger logger = LoggerFactory.getLogger(SpringbootHelloworldStartApplication.class);

	public static void main(String[] args) {
		ConfigurableApplicationContext context = SpringApplication.run(SpringbootHelloworldStartApplication.class);
		logger.info("容器中共有" + context.getBeanDefinitionCount() + "个bean");
		boolean containsBean = context.containsBean("myDog");
		logger.info("是否包含myDog:" + containsBean);
		boolean getDog = context.containsBean("getDog");
		logger.info("是否包含getDog:" + getDog);
	}
}
